\defmodule{InverseGaussianGen}

This class implements random variate generators for 
the {\em inverse Gaussian\/} distribution with location parameter
$\mu > 0$ and scale parameter $\lambda > 0$.
The density function of this distribution is
\begin{htmlonly}
\eq
   f(x) = \sqrt{\lambda / (2\pi x^{3})\; e^{-\lambda(x - \mu)^2 / (2\mu^2x)}
\qquad\mbox{ for } x > 0.
\endeq
\end{htmlonly}%
\begin{latexonly}%
\eq
 f(x) = \sqrt{\frac{\lambda}{2\pi x^{3}}}\; e^{{-\lambda(x - \mu)^2}/{(2\mu^2x)}}
\qquad\mbox {for } x > 0.
\eqlabel{eq:fInverseGaussian}
\endeq
\end{latexonly}%

\bigskip\hrule\bigskip

\begin{code}
\begin{hide}
/*
 * Class:        InverseGaussianGen
 * Description:  random variate generators for the inverse Gaussian distribution
 * Environment:  Java
 * Software:     SSJ 
 * Copyright (C) 2001  Pierre L'Ecuyer and Universite de Montreal
 * Organization: DIRO, Universite de Montreal
 * @author       
 * @since

 * SSJ is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License (GPL) as published by the
 * Free Software Foundation, either version 3 of the License, or
 * any later version.

 * SSJ is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * A copy of the GNU General Public License is available at
   <a href="http://www.gnu.org/licenses">GPL licence site</a>.
 */
\end{hide}
package umontreal.iro.lecuyer.randvar;\begin{hide}
import umontreal.iro.lecuyer.rng.*;
import umontreal.iro.lecuyer.probdist.*;
\end{hide}

public class InverseGaussianGen extends RandomVariateGen \begin{hide} {
   protected double mu = -1.0;
   protected double lambda = -1.0;

\end{hide}
\end{code}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection* {Constructors}
\begin{code}

   public InverseGaussianGen (RandomStream s, double mu, double lambda) \begin{hide} {
      super (s, new InverseGaussianDist(mu, lambda));
      setParams (mu, lambda);
   }\end{hide}
\end{code} 
\begin{tabb}  Creates an {\em inverse Gaussian\/} random variate generator
 with parameters $\mu = $ \texttt{mu} and $\lambda= $ \texttt{lambda},
  using stream \texttt{s}. 
\end{tabb}
\begin{code}

   public InverseGaussianGen (RandomStream s, InverseGaussianDist dist) \begin{hide} {
      super (s, dist);
      if (dist != null)
         setParams (dist.getMu(), dist.getLambda());
   }\end{hide}
\end{code}
  \begin{tabb} Creates a new generator for the distribution \texttt{dist},
     using stream \texttt{s}.
  \end{tabb}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
\subsubsection* {Methods}
\begin{code}

   public static double nextDouble (RandomStream s,
                                    double mu, double lambda)\begin{hide} {
      return InverseGaussianDist.inverseF (mu, lambda, s.nextDouble());
   }\end{hide}
\end{code}
\begin{tabb} Generates a variate from the inverse gaussian distribution
   with location parameter $\mu > 0$ and scale parameter $\lambda > 0$.
\end{tabb}
\begin{code}

   public double getMu()\begin{hide} {
      return mu;
   }\end{hide}
\end{code}
 \begin{tabb} Returns the parameter $\mu$ of this object.
 \end{tabb}
\begin{code}

   public double getLambda()\begin{hide} {
      return lambda;
   }\end{hide}
\end{code}
 \begin{tabb} Returns the parameter $\lambda$ of this object.
 \end{tabb}
\begin{hide}\begin{code}

   protected void setParams (double mu, double lambda) {
      if (lambda <= 0.0)
         throw new IllegalArgumentException ("lambda <= 0");
      if (mu <= 0.0)
         throw new IllegalArgumentException ("mu <= 0");
      this.mu = mu;
      this.lambda = lambda;
   }
\end{code}
\begin{tabb}
   Sets the parameters $\mu$ and $\lambda$ of this object.
\end{tabb}
\begin{code}
}
\end{code}
\end{hide}
